﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FoodController : MonoBehaviour {

    public GameObject foods;

    public GameObject FoodSpherePrefeb;
    public GameObject FoodTrianglePrefeb;
    public GameObject FoodRectanglePrefeb;
    public GameObject FoodPentagonPrefeb;
    public GameObject FoodHaxagonPrefeb;

    // Use this for initialization
    void Start () {
        this.RandInitFood();
    }
    
    void RandInitFood() {
        string name = "";
        for (int i = 0; i < Consts.InitFood; i++)
        {
            GameObject prefeb;
            switch (i % 5) {
                case 1:
                    prefeb = FoodTrianglePrefeb;
                    name = "Triangle";
                    break;
                case 2:
                    prefeb = FoodRectanglePrefeb;
                    name = "Rectangle";
                    break;
                case 3:
                    prefeb = FoodPentagonPrefeb;
                    name = "Pentagon";
                    break;
                case 4:
                    prefeb = FoodHaxagonPrefeb;
                    name = "Haxagon";
                    break;
                case 0:
                default:
                    prefeb = FoodSpherePrefeb;
                    name = "Sphere";
                    break;
            }
            GameObject inst = (GameObject)Instantiate(prefeb, Utils.RandomPos(), Quaternion.identity);
            inst.transform.parent = this.foods.transform;
            inst.name = name;
        }
    }

	// Update is called once per frame
	void Update () {
		
	}
}
